package com.fix.dao.impl;

import java.sql.Connection;
import java.sql.SQLException;

import org.apache.commons.dbutils.QueryRunner;
import org.apache.commons.dbutils.handlers.BeanHandler;

import com.fix.dao.UserDao;
import com.fix.entity.User;
import com.fix.*;





public class UserDaoImpl implements UserDao{

	DbPool pool =DbPool.getPool();
	@Override
	public User login(String name, String pass) throws SQLException {
		
		String sql ="select * from user where uname=?and upass=?";
		Connection conn=pool.getConn();
		QueryRunner runner =new QueryRunner();
		User user =(User)runner.query(conn,sql,new BeanHandler(User.class),name,pass);
		System.out.println(user);
		pool.back(conn);
		
		return user;
	}

}
